package com.util.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.springframework.stereotype.Repository;

@Repository("simpleRuntimeCommand")
public class SimpleRuntimeCommand extends AbstractRuntimeCommand{
	
	@Override
	public BufferedReader execCommand(String command) throws IOException {
		process = Runtime.getRuntime().exec(command);
		BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
        return br;
	}
	
	public static void main(String[] args) throws IOException {
		SimpleRuntimeCommand dd = new SimpleRuntimeCommand();
		BufferedReader bf = dd.execCommand("d:/tomcat/tomcat-6.0.26/bin/catalina.bat run");
		String strLine = "";
		while((strLine = bf.readLine()) != null){
			System.out.println(strLine);
		}
	}
}
